﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/BlogAdmin.Master" AutoEventWireup="true" CodeBehind="PostEdit.aspx.cs" Inherits="Press.MVC.Web.Views.BlogAdmin.PostEdit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<%= Html.Validation().ValidatorRegistrationScripts() %>
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
  <%= ViewData.Model.Post.AllowComments.ToString()  %>
 
 <% using (Html.Form("BlogAdmin", "PostSave", FormMethod.Post, Html.Validation().FormValidation("required"))) { %> 
 
    <%= Html.Hidden("blogid", ViewData.Model.Post.BlogId.ToString())%>
    <%= Html.Hidden("postid", ViewData.Model.Post.BlogId.ToString())%>
    
     <table>
            
            <tr>
                <td>Category:</td>
                <td><%= Html.Form().Select("categoryId", ViewData.Model.PostCategories, "Name", "ID", new Hash(firstOption => "Please select...",selectedValue => new[] { ViewData.Model.Post.PostCategoryID })) %> 
                
                </td>
            </tr>
                
            <tr>
                <td>Title:</td>
                <td><%= Html.TextBox("Title",ViewData.Model.Post.Title) %>
                <%= Html.Validation().RequiredValidator("titleVal", "Title", "You must supply a 'Post' Title.", "required")%>
                </td>
            </tr>

            <tr>
                <td>Summary:</td>
                <td><%= Html.TextBox("Summary",ViewData.Model.Post.Summary) %>
                <%= Html.Validation().RequiredValidator("summaryVal", "Summary", "You must supply a 'Post' Summary.", "required")%>
                </td>
            </tr>

            <tr>
                <td>Body:</td>
                <td><%=Html.TextArea("Body",ViewData.Model.Post.Body,15,50) %><br />
                <%= Html.Validation().RequiredValidator("bodyVal", "Body", "You must supply a 'Post' Body.", "required")%>
                </td>
            </tr>            
            <tr>
                <td>Comments enabled: </td>
                <td>
                
                <%= Html.Form().RadioField("AllowComments", ViewData.Model.Post.AllowComments, new Hash(label => "Allow Post Comments"))%><br />
		        <%= Html.Form().RadioField("AllowComments", ViewData.Model.Post.AllowComments, new Hash(label => "Do not allow Post Comments"))%>
		
                
                </td>
            </tr>
            
        </table>

        <p></p>
    
    <%= Html.Validation().ValidatorInitializationScripts() %>
    
    <%= Html.SubmitButton("savepost","Save")%>
    
<%}%>
 
 
</asp:Content>
